package com.LFLWZ.utils;

import com.LFLWZ.beans.POJO.ClassroomCourse;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class contrast {

    /**
     * 对比获取两个集合中相同的元素
     * @param courses1
     * @param courses2
     * @return
     */
    public  List<ClassroomCourse> ContrastSimilarity(List<ClassroomCourse> courses1, List<ClassroomCourse> courses2){
        List<ClassroomCourse> courses=new ArrayList<>();
        for (ClassroomCourse c1:courses1){
            for (ClassroomCourse c2:courses2){
                if (c2.getId()==c1.getId()){
                    courses.add(c2);
                }
            }
        }
        return courses;
    }
}
